package org.example.spring.service;

import org.example.spring.entity.Books;
import org.example.spring.mapper.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BookService {
    @Autowired
    private BookMapper bookMapper;

    public int save(Books books) {
        if(books.getBookId() == null) {
            return bookMapper.insert(books);
        } else {
            return bookMapper.update(books);
        }
    }
}